<?php

/**
 * This is the model class for table "tbl_Customer".
 *
 * The followings are the available columns in table 'tbl_Customer':
 * @property integer $customerID
 * @property string $loginID
 * @property string $password
 * @property string $agentCode
 * @property string $firstName
 * @property string $lastName
 * @property string $email
 * @property string $address
 * @property string $city
 * @property string $stateID
 * @property string $zipCode
 * @property integer $referredSource
 * @property string $createdDate
 * @property string $lastLogonDate
 * @property string $modifiedDate
 * @property integer $preferLanguageID
 *
 * The followings are the available model relations:
 * @property TblCustomerCSIRelation[] $tblCustomerCSIRelations
 */
class TblCustomerProfile extends CActiveRecord
{
	
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return TblCustomerProfile the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_Customer';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('referredSource, preferLanguageID', 'numerical', 'integerOnly'=>true),
			array('loginID, email', 'length', 'max'=>150),
			array('password, firstName, lastName, address, city', 'length', 'max'=>50),
			array('agentCode', 'length', 'max'=>30),
			array('stateID', 'length', 'max'=>2),
			array('zipCode', 'length', 'max'=>12),
			array('createdDate, lastLogonDate, modifiedDate, phone', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('customerID, loginID, password, agentCode, firstName, lastName, email, address, city, stateID, zipCode, referredSource, createdDate, lastLogonDate, modifiedDate, preferLanguageID', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'customerID' => 'Customer',
			'loginID' => 'Login',
			'password' => 'Password',
			'agentCode' => 'Agent Code',
			'firstName' => 'First Name',
			'lastName' => 'Last Name',
			'email' => 'Email',
			'address' => 'Address',
			'city' => 'City',
			'stateID' => 'State',
			'zipCode' => 'Zip Code',
			'referredSource' => 'Referred Source',
			'createdDate' => 'Created Date',
			'lastLogonDate' => 'Last Logon Date',
			'modifiedDate' => 'Modified Date',
			'preferLanguageID' => 'Prefer Language',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('customerID',$this->customerID);
		$criteria->compare('loginID',$this->loginID,true);
		$criteria->compare('password',$this->password,true);
		$criteria->compare('agentCode',$this->agentCode,true);
		$criteria->compare('firstName',$this->firstName,true);
		$criteria->compare('lastName',$this->lastName,true);
		$criteria->compare('email',$this->email,true);
		$criteria->compare('address',$this->address,true);
		$criteria->compare('city',$this->city,true);
		$criteria->compare('stateID',$this->stateID,true);
		$criteria->compare('zipCode',$this->zipCode,true);
		$criteria->compare('referredSource',$this->referredSource);
		$criteria->compare('createdDate',$this->createdDate,true);
		$criteria->compare('lastLogonDate',$this->lastLogonDate,true);
		$criteria->compare('modifiedDate',$this->modifiedDate,true);
		$criteria->compare('preferLanguageID',$this->preferLanguageID);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
	
	
}